package com.example.activitytest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import kotlinx.android.synthetic.main.second_layout.*

class SecondActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.second_layout)
        val data = intent.getStringExtra("extra_data")
        Toast.makeText(this,data,Toast.LENGTH_SHORT).show()
        button2.setOnClickListener{
            val intent = Intent()
            intent.putExtra("data_back","Hello MotherFucker")
            setResult(RESULT_OK,intent)
            finish()
        }
    }
}